package com.snow.useviewdemo.function;

import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.snow.common.base.BaseBasesActivity;
import com.snow.useviewdemo.R;
import com.snow.useviewdemo.adapter.NAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * author : zyt
 * e-mail : 632105276@qq.com
 * date   : 2019-11-07
 * desc   :RecyclerView的item长按复制功能
 */
public class RecyclerViewTestActivity extends BaseBasesActivity {
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_recycler_view;
    }

    @Override
    protected void initView() {
        //详细
        NAdapter nAdapter = new NAdapter<String>(this, R.layout.item_only_text_layout, null) {
            @Override
            public void onBindViewHolder(NViewHolder holder, String value, int position) {
                TextView textView = holder.getView(R.id.textView);
                textView.setText(value);
            }
        };

        List dataList = new ArrayList<>();
        recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
//        recyclerView.addItemDecoration(new RecyclerLinearDecoration(TextViewUtils.init().getDpValue(this, R.dimen.margin_016), LinearLayoutManager.VERTICAL));
        recyclerView.setAdapter(nAdapter);
        for (int i = 0; i < 20; i++) {
            dataList.add("很快很快就会给高科技啊是的===" + i);
        }
        nAdapter.replaceData(dataList);

    }

}
